/*
 * 中北大学软件学院版权所有2020-2025
 */
package nuc.lp.uolab.user.service;

import java.util.List;

import nuc.lp.uolab.user.dao.UserDao;
import nuc.lp.uolab.user.dao.UserDaoImpl;
import nuc.lp.uolab.user.vo.User;

/**
 * 用户业务实现类：用户登录
 * @author liupeng
 * @version 1.0
 */
public class UserServiceImpl implements UserService{
	/*
	 * UserDao对象，在当前类中要使用它
	 */
	private UserDao UserDao = new UserDaoImpl();
	
	@Override
	public List<User> findUser(String uname, String dname, String major, String classes, String grade) {
		List<User> ulist = UserDao.selectUser(uname, dname, major, classes, grade);
		return ulist;
	}
	@Override
	public int deleteUser(String userid) {
		int count = UserDao.deleteUser(userid);
		return count;
	}
	@Override
	public int modifyUser(User user) {
		int count = UserDao.updateUser(user);
		return count;
	}
	public boolean addUser(User user) {
		boolean flag = UserDao.insertUser(user);
		return flag;
	}
	//创建UserDaoImpl对象，以便UserServiceImpl来使用它
	//多态机制（这种写法在Spring中大量使用）
	@Override
	public boolean checkUser(String userName, String userPsw) {
		boolean flag = UserDao.login(userName, userPsw);
		return flag;
	}
		
}
